package system.track;

import system.train.Train;

/**
 * Represents the behavior all sensors should implement.
 * 
 * This interface allows sensors to maintain similar behavior
 * while allowing for the implementing class to account for any special 
 * circumstances a sensors placement may cause.
 * 
 * @author David Kolb
 * @version Cycle 1 - complete
 */
public interface Sensor
{
    /**
     * Registers an integer ID with the the sensor.
     *  
     * @param id the ID number of the sensor from the track map
     */
    public void setID(int id);
    
    /**
     * Retrieves the ID number of the sensor.
     * 
     * @return an ID number that matches the number of a sensor on the map.
     */
    public int getID();

    /**
     * This registers a train to recieve notification calls when the sensor
     * is tripped.
     *
     * @param t a reference to the train object to register.
     */
    public void registerForNotification(Train t);
    
    /**
     * This removes a train from the sensors internal data structure of trains
     * to notify when it is tripped.
     * 
     * @param t a reference to the train to remove from notification.
     */
    public void unregisterForNotification(Train t);

    /**
     * This function is called when a sensor is tripped.
     *
     * The major effect of this is that the sensor will notify
     * any trains registered to it.
     */
    public void tripped();
}